package se.olli.mewiki;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.GridView;
import android.view.*;

public class AndroidDesignActivity extends Activity {
	
	public final static String CHARACTER = "se.olli.design.character";
	
	public void onCreate(Bundle savedInstanceState) {
	    super.onCreate(savedInstanceState);
	    setContentView(R.layout.main);

	    GridView gridview = (GridView) findViewById(R.id.gridview);
	    gridview.setAdapter(new ImageAdapter(this));

	    gridview.setOnItemClickListener(new OnItemClickListener() {
	        public void onItemClick(AdapterView<?> parent, View v, int position, long id) {
	        	Intent charIntent = new Intent(AndroidDesignActivity.this, CharacterActivity.class);
	        	charIntent.putExtra(CHARACTER, position);
	        	startActivity(charIntent);
	        }
	    });
	}
    
}
